package com.mice.command{
	import com.iyimo.core.mvc.Command;
	import com.mice.command.bean.UserBean;
	
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	/**
	 * 请求用户基本信息
	 */	
	public class Cmd100 extends Command{
		public function Cmd100(){
			super(100);
		}
		
		override public function execute():void{
			var urlLoader:URLLoader = new URLLoader(new URLRequest("assets/data/db.txt"));
			urlLoader.addEventListener(Event.COMPLETE, onComplete);
		}
		
		private function onComplete(e:Event):void{
			var data:String = e.target.data;
			var arr:Array = data.split("\n");
			var bean:UserBean = new UserBean();
			bean.name = (arr[0] as String).split(":")[1];
			bean.level = (arr[1] as String).split(":")[1];
			_response = bean;
			onSuccess();
		}
	}
}